<?php

session_start();

$isSignin = isset($_SESSION['user'])? true : false;
$user = isset($_SESSION['user'])?$_SESSION['$user'] : null;
$id = $_GET['id'];
$cart = isset($_SESSION['cart'])?$_SESSION['cart'] : [];

$index = -1;
for ($i=0; $i <count($cart) ; $i++) { 
	if ($cart[$i]['id'] == $id) {
		$index = $i;
		break;
	}
}

if ($index > -1) {
	array_splice($cart, $index,1);
}

$_SESSION['cart'] = $cart;

header('Location:../public/cart.php');